<?php
/*******************************************************************************
 *  This file is part of mysql-proxy.
 *
 *  mysql-proxy is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  mysql-proxy is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *******************************************************************************
 * Author: Lidanyang  <simonarthur2012@gmail.com>
 ******************************************************************************/


namespace Proxy;


interface Reporter
{
    /**
     * @param $config       array       配置选项
     * @return bool
     */
    public function init($config);

    /**
     * @param $key      string
     * @return mixed
     */
    public function exists($key);

    /**
     * @param $key      string
     * @param $data     string
     * @param $expire   int         超时时间，单位秒
     * @return bool
     */
    public function set($key, $data, $expire);

    /**
     * @param $key      string
     * @param $rank     int
     * @param $data     string
     * @return bool
     */
    public function add($key, $rank, $data);


    /**
     * @param $key      string
     * @param $hash_key string
     * @param $data     string
     * @return bool
     */
    public function hash($key, $hash_key, $data);

    /**
     * @param $key          string
     * @param $timestamp    int         超时时刻的时间戳
     * @return bool
     */
    public function expireAt($key, $timestamp);

    /**
     * @param $key      string
     * @param $expire   int         超时时间，单位秒
     * @return bool
     */
    public function expire($key, $expire);

}